package day06;

import java.util.Random;

public class MethodDemo {
    public static void main(String[] args) {
        say();
        say("李四");
        say("张三",18);
        int a = sum(5,6);
        System.out.println(a);

        int m =5,n=6;
        int b = sum(m,n);
        System.out.println(b);

        int[] c = generateArray(5,50);
        System.out.println("数组的长度为："+c.length);
        for (int i =0;i< c.length;i++){
            System.out.println(c[i]);
        }


        int[] d= generateArray(10,30);
        System.out.println("第一个元素的值："+d[0]);
        for (int i =0;i<d.length;i++) {
            System.out.println(d[i]);
        }
        say("张三",25);
        say("李四",60);

    }



    public static int[] generateArray(int len,int max) {
        Random rand = new Random();
        int[] arr = new int[len];
        for (int i = 0; i < arr.length; i++){
            arr[i] = rand.nextInt(max+1);
    }
        return  arr;
    }


    public static int sum(int num1,int num2){
        int num = num1+num2;
        return num;
    }

    public static void say(String name, int age){
        if (age >=50){
            return;
        }
        System.out.println("你好！我叫"+name+"，今年"+age+"岁了！");
    }

    public static void say(String name){
        System.out.println("您好！，我叫"+name+",我是你爹！");
    }
    public static  void say(){
        System.out.println("你好！我是你爹，你是我儿子！");
    }
}
